/*
 * @Author: your name
 * @Date: 2021-03-12 17:10:29
 * @LastEditTime: 2021-03-13 11:52:26
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \happy\assets\js\user\edit.js
 */
// ****************************************编辑用户
$(function () {
  let form1 = layui.form;
  let str =window.location.href.split('?');
  let id =  str[1].toString().slice(-1);
  // console.log(id);
  let form = document.querySelector("form");
  form.addEventListener('submit', function (e) {
    e.preventDefault();
    let formData = form1.val('editForm');  
    formData.id = id ;
    console.log(formData);
    $.ajax({
      type: "put",
      url: "admin/users",
      data: formData,
      success: function (response) {
        console.log(response);
      }
    });
  });
})